
<form action="product.html.php?action=make_html" id="form1" name="form1" method="post" style="margin-bottom:20px">
    <table width="680" class="from_table2_one">
		<thead>
			<tr class="area_ajax_list_title">
			  <th class="pd-left" width="50"><tpl> $langSysPSelect </tpl></th>
			  <th width="580"><tpl> $langSysPClass </tpl></th>
			</tr>
		</thead>
		<tr>
			<td colspan="2"><div class="btn_marginleft">
			<span class="btn_left"><input class="btn_submit" name="selectall" type="button" id="selectall" onclick="selectAll()" value="<tpl> $langSysPAllSelect </tpl>" /></span>
			<span class="btn_left"><input class="btn_submit" name="negative" type="button" id="negative" onclick="selectOp()" value="<tpl> $langSysPcontrarySelect </tpl>" /></span>
			<span class="btn_left"><input class="btn_submit" type="submit" name="Submit" value="<tpl> $langSysPCreateStaticPage </tpl>" /></span>
			</div></td>
		</tr>
		<tpl> if $ProductClassArray[0].id neq '' </tpl>
			  <tpl> section name=listclass loop=$ProductClassArray </tpl>
			  <tr>
				<td width="50"><input name="chboxPCId[]" type="checkbox" value="<tpl> $ProductClassArray[listclass].id </tpl>" title=""/></td>
				<td width="630" align="left" class="td1"><div style="float:left; padding-left:5px">
				  <tpl> $ProductClassArray[listclass].name </tpl></div>
				  <div style="float:left; padding-left:5px">
				<a onclick="ajax_html('<tpl> $ProductClassArray[listclass].id </tpl>');" href="javascript:;" title="<tpl> $langSysPStatic </tpl>" class="static_a_pic"></a> </div> <input type="hidden" name="id[]" value="<tpl> $ProductClassArray[listclass].id </tpl>" /></td>
			  </tr>
		<tpl> /section </tpl>
			
		<tpl> else  </tpl>
			<tr>
				<td colspan="4" align="center"><tpl> $langCNull </tpl></td>
			</tr>
		<tpl> /if  </tpl>
  </table>
  <tpl> if $ProductClassArray[0].id neq '' </tpl>
  <div class="table-5-bottom"><div class="btn_marginleft">
		  <span class="btn_left">
			        <input class="btn_submit" name="selectall" type="button" id="selectall" onclick="selectAll()" value="<tpl> $langSysPAllSelect </tpl>" /></span>
					  <span class="btn_left">
			        <input class="btn_submit" name="negative" type="button" id="negative" onclick="selectOp()" value="<tpl> $langSysPcontrarySelect </tpl>" />
					</span>
					  <span class="btn_left">
		            <input class="btn_submit" type="submit" name="Submit" value="<tpl> $langSysPCreateStaticPage </tpl>" />
					</span>
					
		          </p>
			    </div></div>
				<tpl> /if  </tpl>
</form>
<script>
function selectAll(){
	$('#form1 input[@type=checkbox]').each(function(){
		$(this).attr('checked',true)
	})
}
function selectOp(){
	$('#form1 input[@type=checkbox]').each(function(){
		$(this).attr('checked',!$(this).attr('checked'))
	})
}

$(document).ready(function() {
	
	<tpl> if $list_class_error != '' </tpl>
	//输出后台程序错误信息
	showMessage(<tpl> $list_class_error </tpl>);
	<tpl> /if </tpl>
	
//提交表单	
	var options = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
					},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		},
		messages: {
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});	
	
});

//生成静态
function ajax_html(str){
	var queryString='action=make_html&chboxPCId='+str;

	$.ajax({
		url: "product.html.php",
		data: queryString,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
		}
	});
	return false;
}
</script>
